/*
 * IntroScreen.java
 *
 * Created on May 3, 2006, 9:17 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package Experience.Screens;

import Comm.Util.Logger;
import Experience.*;
import java.io.IOException;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;

/**
 *
 * @author dmgreen
 */
public class IntroScreen extends ChoiceScreen {
    
     private MIDlet myMIDlet;
    
    /** Creates a new instance of IntroScreen */
    public IntroScreen(MIDlet mid, int numPics, int numClips) {
        
        super(mid, "placeholder", 20, "Hide", "New");

        myMIDlet = mid;

        
        String msg_string = "";
        
        msg_string += "Thank you for using the MAHI program. ";
        
        if (numClips >= 0) {
             msg_string += "Your " + numPics + " pictures and " + numClips
                        + " audio notes will be uploaded shortly. ";
         }
        
        msg_string += "Press the \"New\" button to start a new sample, or " +
                "press \"Hide\" to hide MAHI. ";
                
        setText(msg_string);
        
        
    }
    
    protected void leftPressed() {
        ((ExpUI) myMIDlet).notifyClose(false);
    }
    protected void rightPressed() {
        //REMEMBER TO PUT BACK IN!
        ((ExpUI) myMIDlet).notifyClose(false);
        ((ExpUI) myMIDlet).startNewSample();
    }
    
    protected void keyReleased (int keyCode) {
        
        super.keyReleased(keyCode);
        
        int action = getGameAction(keyCode);
        
        if (action == Canvas.LEFT) { 
            //((ExpUI) myMIDlet).showPreferencesScreen(); 
            ((ExpUI) myMIDlet).showLogScreen();
         }
         else if (action == Canvas.RIGHT) { 
            ((ExpUI) myMIDlet).showPreferencesScreen(); 
            //((ExpUI) myMIDlet).showLogScreen();
         }
         else if (action == Canvas.UP) { 
           ((ExpUI) myMIDlet).myUS.setTimeoutFlag(false);
           Logger.getLog().addLogMessage("Timeout reset", Logger.MSG_DEBUG);
        }
    }
}
